﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BizElements.Web
{
    /// <summary>Contains common text messages used in UI.</summary>
    public static class UiMessages
    {
        private static string GetFromTextSource(string key)
        {
            if (UserSession.MessageSource != null)
                return UserSession.MessageSource.GetString(key);
            else
                return null;
        }

        #region Form buttons/actions messages (Entity UI).

        /// <summary>Gets string stored under the <b>UiMessages_CancelText</b> key.</summary>
        public static string CancelText
        {
            get { return UserSession.MessageSource.GetString("UiMessages_CancelText") ?? Messages.UiMessages_CancelText; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_CancelToolTip</b> key.</summary>
        public static string CancelToolTip
        {
            get { return UserSession.MessageSource.GetString("UiMessages_CancelToolTip") ?? Messages.UiMessages_CancelToolTip; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_CorrectDisplayedErrors</b> key.</summary>
        public static string CorrectDisplayedErrors
        {
            get { return UserSession.MessageSource.GetString("UiMessages_CorrectDisplayedErrors") ?? Messages.UiMessages_CorrectDisplayedErrors; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_DataSuccessfullySaved</b> key.</summary>
        public static string DataSuccessfullySaved
        {
            get { return UserSession.MessageSource.GetString("UiMessages_DataSuccessfullySaved") ?? Messages.UiMessages_DataSuccessfullySaved; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_DeactivateConfirmationMessage</b> key.</summary>
        public static string DeactivateConfirmationMessage
        {
            get { return UserSession.MessageSource.GetString("UiMessages_DeactivateConfirmationMessage") ?? Messages.UiMessages_DeactivateConfirmationMessage; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_DeactivateText</b> key.</summary>
        public static string DeactivateText
        {
            get { return UserSession.MessageSource.GetString("UiMessages_DeactivateText") ?? Messages.UiMessages_DeactivateText; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_DeactivateToolTip</b> key.</summary>
        public static string DeactivateToolTip
        {
            get { return UserSession.MessageSource.GetString("UiMessages_DeactivateToolTip") ?? Messages.UiMessages_DeactivateToolTip; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_NewParentConfirmationMessage</b> key.</summary>
        public static string NewParentConfirmationMessage
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NewParentConfirmationMessage") ?? Messages.UiMessages_NewParentConfirmationMessage; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_NewParentText</b> key.</summary>
        public static string NewParentText
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NewParentText") ?? Messages.UiMessages_NewParentText; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_NewParentToolTip</b> key.</summary>
        public static string NewParentToolTip
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NewParentToolTip") ?? Messages.UiMessages_NewParentToolTip; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_ParentDetailsConfirmationMessage</b> key.</summary>
        public static string ParentDetailsConfirmationMessage
        {
            get { return UserSession.MessageSource.GetString("UiMessages_ParentDetailsConfirmationMessage") ?? Messages.UiMessages_ParentDetailsConfirmationMessage; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_ParentDetailsText</b> key.</summary>
        public static string ParentDetailsText
        {
            get { return UserSession.MessageSource.GetString("UiMessages_ParentDetailsText") ?? Messages.UiMessages_ParentDetailsText; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_ParentDetailsToolTip</b> key.</summary>
        public static string ParentDetailsToolTip
        {
            get { return UserSession.MessageSource.GetString("UiMessages_ParentDetailsToolTip") ?? Messages.UiMessages_ParentDetailsToolTip; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_SaveText</b> key.</summary>
        public static string SaveText
        {
            get { return UserSession.MessageSource.GetString("UiMessages_SaveText") ?? Messages.UiMessages_SaveText; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_SaveToolTip</b> key.</summary>
        public static string SaveToolTip
        {
            get { return UserSession.MessageSource.GetString("UiMessages_SaveToolTip") ?? Messages.UiMessages_SaveToolTip; }
        }

        #endregion

        /// <summary>Gets string stored under the <b>UiMessages_OpenText</b> key.</summary>
        public static string OpenText
        {
            get { return UserSession.MessageSource.GetString("UiMessages_OpenText") ?? Messages.UiMessages_OpenText; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_OpenToolTip</b> key.</summary>
        public static string OpenToolTip
        {
            get { return UserSession.MessageSource.GetString("UiMessages_OpenToolTip") ?? Messages.UiMessages_OpenToolTip; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_NewRecordText</b> key.</summary>
        public static string NewRecordText
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NewRecordText") ?? Messages.UiMessages_NewRecordText; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_NewRecordToolTip</b> key.</summary>
        public static string NewRecordToolTip
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NewRecordToolTip") ?? Messages.UiMessages_NewRecordToolTip; }
        }

        #region SecurityHelper.

        /// <summary>Gets string stored under the <b>UiMessages_NotAllowedToExecuteAction</b> key.</summary>
        public static string NotAllowedToExecuteAction
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NotAllowedToExecuteAction") ?? Messages.UiMessages_NotAllowedToExecuteAction; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_NotAllowedToOpenForm</b> key.</summary>
        public static string NotAllowedToOpenForm
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NotAllowedToOpenForm") ?? Messages.UiMessages_NotAllowedToOpenForm; }
        }

        #endregion

        #region BindingsUtil.

        /// <summary>Gets string stored under the <b>UiMessages_DateTimeParseError</b> key.</summary>
        public static string DateTimeParseError
        {
            get { return UserSession.MessageSource.GetString("UiMessages_DateTimeParseError") ?? Messages.UiMessages_DateTimeParseError; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_DefaultParseError</b> key.</summary>
        public static string DefaultParseError
        {
            get { return UserSession.MessageSource.GetString("UiMessages_DefaultParseError") ?? Messages.UiMessages_DefaultParseError; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_IntegerParseError</b> key.</summary>
        public static string IntegerParseError
        {
            get { return UserSession.MessageSource.GetString("UiMessages_IntegerParseError") ?? Messages.UiMessages_IntegerParseError; }
        }

        /// <summary>Gets string stored under the <b>UiMessages_NumberParseError</b> key.</summary>
        public static string NumberParseError
        {
            get { return UserSession.MessageSource.GetString("UiMessages_NumberParseError") ?? Messages.UiMessages_NumberParseError; }
        }
        
        #endregion
        
        /// <summary>Gets string stored under the <b>UiMessages_AreYouSure</b> key.</summary>
        public static string AreYouSure
        {
            get { return UserSession.MessageSource.GetString("UiMessages_AreYouSure") ?? Messages.UiMessages_AreYouSure; }
        }
    }
}
